import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexTest3 {
    // 通过正则表达式找出下列文本中的邮箱和电话号码
    public static void main(String[] args) {

    String data = "哈哈哈哈,我的手机号是17392755291,我的邮箱是1439832@qq.com";
    String regex = "(\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}) | (1[3-9]\\d{9})";

    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(data);
    while (matcher.find()){
        String rs = matcher.group();
        System.out.println(rs);
    }

    }
}
